#include <stdio.h>
#define ROW 5
#define COLUMN 5
int main(void)
{
    int matrix[ROW][COLUMN] = {0};
    for (int i = 0; i < ROW; i++) {
        printf("Enter row %d: ", i + 1);
        for (int j = 0; j < COLUMN; j++)
            scanf("%d", &matrix[i][j]);
    }

    printf("Row totals: ");
    for (int i = 0; i < ROW; i++) {
        int sum = 0;
        for (int j = 0; j < COLUMN; j++)
            sum += matrix[i][j];
        printf(" %d", sum);
    }
    printf("\n");

    printf("Column totals: ");
    for (int i = 0; i < COLUMN; i++) {
        int sum = 0;
        for (int j = 0; j < ROW; j++)
            sum += matrix[j][i];
        printf(" %d", sum);
    }
    printf("\n");
    return 0;
}